package com.learn.thread;

/**
 * 守护线程
 */
public class TestThreadDaemon {

    public static void main(String[] args) {
        Thread t1 = new Thread(new DeadQinRen());
        Thread t2 = new Thread(new Yous());
        t1.setDaemon(true);
        t1.start();
        t2.start();

    }
}

class DeadQinRen implements Runnable {
    @Override
    public void run() {
       while (true){
           System.out.println("一直守护着你");
       }
    }
}

class Yous implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i <= 365; i++) {
            System.out.println("365天，天天开心" + i);
        }
    }
}